package com.shengjing.apk.util;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;

public class SystemUtil {
    public static void putTextIntoClip(Context context, String msg) {
        ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
        //创建ClipData对象
        ClipData clipData = ClipData.newPlainText("simple text copy", msg);
        //添加ClipData对象到剪切板中
        clipboardManager.setPrimaryClip(clipData);
    }
}
